#include "talent.h"

const QString Talent::KEY_ACTION = "action";
const QString Talent::KEY_KARMA = "karma";
const QString Talent::KEY_EFFORT = "effort";
const QString Talent::KEY_LEVEL = "level";

Talent::Talent(const QMap<QString,QString>& values) :
    XMLItem(values)
{
    Q_ASSERT(values.contains(KEY_ACTION));
    Q_ASSERT(values.contains(KEY_KARMA));
    Q_ASSERT(values.contains(KEY_EFFORT));
    Q_ASSERT(values.contains(KEY_LEVEL));

    _action = values[KEY_ACTION];
    _karma = values[KEY_KARMA];
    _effort = values[KEY_EFFORT];
    _level = Level(values[KEY_LEVEL]);
}

Talent::Talent()
  : XMLItem()
{
}

QString Talent::keyValue(const QString &key) const
{
    if (key == KEY_ACTION) return action();
    if (key == KEY_KARMA) return karma();
    if (key == KEY_EFFORT) return effort();
    if (key == KEY_LEVEL) return level();

    return XMLItem::keyValue(key);
}
